<?php 
function ListNews($idP)
{
    global $dbsql,$language;
    
    $sql_where  = " from tblnews_content where cLanguage='$language' and iStatus=1 ";
    if($idP>0)
    {
        $sql_where  .= " and iParentId=$idP ";
    }
    $sql_select = "select count(iId) as count ".$sql_where;
    $result     = $dbsql->query_fetch($sql_select);
    $countall   = $result['count'];
    
    list($lf,$la)= Split_Page($countall);
    
    $sql_select = "select * ".$sql_where." order by iParentId,iOrder limit $lf,$la";
    return $dbsql->load($sql_select);
}


function getUrlNewsCat($idP)
{
    global $dbsql,$language;
    
    $sql_select = "select cUrlString,iParentId from tblcategory where iId=$idP";
    $result     = $dbsql->query_fetch($sql_select);
    if($result['iParentId']>0)
    {
        $urlP   = getUrlNewsCat($result['iParentId']);
    }
    return $urlP.$result['cUrlString'].'/';
}

function ListOthernews($idP,$id)
{
    global $dbsql,$language;
    
    $sql_select = "select * from tblnews_content where iParentId=$idP and iId!=$id and cLanguage='$language' limit 5";
    return $dbsql->load($sql_select);
}
?>